1. Field of the Invention
The present invention pertains to computer graphics, and more particularly to digital representations of colors for storage and for display.
2. Related Art
For automated processing purposes, the color of a pixel is typically represented as an array of three binary fields, wherein each field contains the value of one of the three color coordinates. If the color is to be represented in the red/green/blue (RGB) color space, for example, one field would contain the value of the red coordinate, a second field would contain the value of the green coordinate, and a third field would contain the value of the blue coordinate.
If the set of colors to be represented requires smooth grayscale shading, the customary solution has been to increase the number of bits used to represent colors. For every additional bit used to represent colors, the number of colors that can be represented doubles. As a result, some applications now use up to 24 bits to represent the color of a single pixel.
While using such a large number of bits permits representation of a large number of colors, it also creates systemic processing problems. Significant amounts of frame buffer memory may be consumed if each pixel of an image requires 24 bits to represent color. Moreover, input and output (I/O) of such an image becomes cumbersome. Every time such an image needs to be transferred to or from memory, sent to a display device, or transferred across a network, for example, significant bandwidth is required. Alternatively, if bandwidth is limited, then the time required for I/O may become burdensome.
Hence there is a need for a system and method whereby color and grayscale shading can be represented with a relatively small number of bits. This would allow adequate color representation while conserving memory and I/O bandwidth.
The present invention provides a system and method for representing the color of a pixel in a binary pixel storage word, wherein color coordinate data and intensity data are coded separately in two fields of the pixel storage word. These two fields are denoted herein as the color field and the intensity field. This permits a range of colors to be represented in a memory device, such as a frame buffer, in a relatively small number of bits. Encoding of intensity data may be performed in several ways. In an embodiment of the invention, intensity data may be encoded with a binary value whose numerical value is between zero and 2kxe2x88x921, where k is the length of the intensity field. The coded intensity in this case can therefore range between zero intensity and full intensity, respectively. In an alternative embodiment of the invention, the intensity may be represented as an intensity index that maps to actual intensity data according to a predefined intensity table.
Encoding of color coordinate data may also be performed in several ways. In one embodiment of the invention, each of the three color coordinates of an input color is coded separately. The coded color components are concatenated and placed in a coded color field of the pixel storage word. In another embodiment of the invention, the color coordinate data is encoded as a color index, a binary value of which corresponds to color coordinate data according to a predefined color table.
The present invention also provides a system and method for converting a pixel storage word into a pixel display word, wherein the latter is a binary representation of the color in a format that permits ready display. The coded color component data is read from the pixel storage word and processed to yield three color coordinates. The coded intensity data is processed to yield the intensity of the color. The color coordinates are then modulated by the intensity. This produces a pixel display word comprising three color coordinates in a form that permits display.
One envisioned application of the invention is the highlighting of features on a medical x-ray image. An operator wishing to designate some point or region of the monochrome image can do so by viewing the image on a computer, defining the area to be highlighted, then choosing a color with which to highlight the area. The color of each pixel in the highlighted area can then be represented using the present invention. For each such pixel, the color coordinate data can be coded and written to the color field of the pixel storage word, and the intensity data can likewise be coded and written to the intensity field. In this application, the intensity data of a color pixel can be derived directly from the grayscale value of the corresponding monochromatic pixel of the original image.